<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .table label {
            display: block;
        }
    </style>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script>
        jQuery(function () {
            (function ($) {
                $(".table input[type=checkbox]").click(function () {
                    $(".all").prop('checked', $(".table input[type=checkbox]").length === $(".table input[type=checkbox]:checked").length);
                });
                $(".all").click(function () {
                    $(".table input[type=checkbox]").prop('checked', $(this).prop('checked'));
                });
            })(jQuery);
        });
    </script>
</head>
<body>
<label>
    <input type="checkbox" class="all">
    <span>全选</span>
</label>
<div class="table">
    <label>
        <input type="checkbox" value="1">
        <span>No.1</span>
    </label>
    <label>
        <input type="checkbox" value="2">
        <span>No.2</span>
    </label>
    <label>
        <input type="checkbox" value="3">
        <span>No.3</span>
    </label>
    <label>
        <input type="checkbox" value="4">
        <span>No.4</span>
    </label>
    <label>
        <input type="checkbox" value="5">
        <span>No.5</span>
    </label>
    <label>
        <input type="radio" name="sex" value="1">
        <span>男</span>
    </label>
    <label>
        <input type="radio" name="sex" value="0">
        <span>女</span>
    </label>
</div>
</body>
</html>